@extends('admin.layout')
@section('title','专家列表')
@section('content')
        <div class="col-md-12" id="content">
            <div class="app_content_div" id="app_content_div_301Index">
                <h3>专家列表</h3>
            </div>

            <div>
                <div style="float:right;">
                    <button type="button" class="btn btn-primary" onclick="window.location.href='/admin/expert/add'">新增专家</button>
                </div>
            </div>
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>id</th>
                    <th>专家名</th>
                    <th>职称</th>
                    <th>科室</th>
                    <th>医院</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($experts as $v){{--遍历$experts变量中的每个元素，并将当前元素赋值给局部变量 $v--}}
                <tr>
                    <td>{{$v->id}}</td>
                    <td>{{$v->name}}</td>
                    <td>{{$v->title}}</td>
                    <td>{{$v->department}}</td>
                    <td>{{$v->hospital}}</td>
                    <td>
                        <a href="/admin/expert/edit/{{$v->id}}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a> &nbsp;&nbsp;&nbsp;
                        <a href="#" onclick="delUser('/admin/expert/delete/{{$v->id}}')"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
                        {{--按钮，点击后会执行函数，传参，用于删除当前专家--}}
                    </td>
                </tr>
                @endforeach
                </tbody>
            </table>
            {{$experts->links('paginate')}}
            <script>
                function delUser(url){
                    if(confirm('确定要删除该专家吗？')){
                        window.location.href = url;
                    }
                }
            </script>
        </div>
@endsection
